package com.ajk.server;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.actuate.autoconfigure.AuditAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.EndpointMBeanExportAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.HealthIndicatorAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.MetricFilterAutoConfiguration;
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.security.AuthenticationManagerConfiguration;
import org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration;
import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration;
import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration;
import org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration;
import org.springframework.boot.autoconfigure.web.HttpEncodingAutoConfiguration;
import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration;
import org.springframework.boot.autoconfigure.web.MultipartAutoConfiguration;
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

import com.ajk.server.config.AResourceConfig;
import com.ajk.server.config.CacheConfiguration;
import com.ajk.server.config.ControllerConfig;
import com.ajk.server.config.DatasourceConfig;
import com.ajk.server.config.RestSecurityConfiguration;
import com.ajk.server.config.UserProfile;
import com.ajk.server.config.remote.HttpInvokerClientConfig;
import com.ajk.server.config.remote.HttpInvokerServerConfig;
import com.ajk.server.service.StartUpCheckService;
import com.ajk.server.utils.SpringContextUtil;


/*
@Configuration

@Import({
	 DispatcherServletAutoConfiguration.class
	,EmbeddedServletContainerAutoConfiguration.class
	,ErrorMvcAutoConfiguration.class
	,HttpEncodingAutoConfiguration.class
	,HttpMessageConvertersAutoConfiguration.class
	,MultipartAutoConfiguration.class
	,ServerPropertiesAutoConfiguration.class
	,PropertyPlaceholderAutoConfiguration.class
	,WebMvcAutoConfiguration.class
	,SecurityAutoConfiguration.class
	,AuthenticationManagerConfiguration.class
	
	,ResourceConfig.class
	,SpringContextUtil.class
	,HttpInvokerClientConfig.class
	,DatasourceConfig.class
	,CacheConfiguration.class
	,HttpInvokerServerConfig.class
	,ControllerConfig.class
	,RestSecurityConfiguration.class
        
})
*/
@Configuration
//@EnableAutoConfiguration
//@SpringBootApplication
@Import({
		DispatcherServletAutoConfiguration.class
		,EmbeddedServletContainerAutoConfiguration.class
		,ErrorMvcAutoConfiguration.class
		,HttpEncodingAutoConfiguration.class
		,HttpMessageConvertersAutoConfiguration.class
		,MultipartAutoConfiguration.class
		,ServerPropertiesAutoConfiguration.class
		,PropertyPlaceholderAutoConfiguration.class
		,WebMvcAutoConfiguration.class
		,SecurityAutoConfiguration.class
		,AuthenticationManagerConfiguration.class

		,AResourceConfig.class
		,SpringContextUtil.class
		,HttpInvokerClientConfig.class
		,DatasourceConfig.class
		,CacheConfiguration.class
		,HttpInvokerServerConfig.class
		,ControllerConfig.class
		,RestSecurityConfiguration.class

		,ManagementServerPropertiesAutoConfiguration.class,
		EndpointWebMvcAutoConfiguration.class,
		EndpointAutoConfiguration.class,
		HealthIndicatorAutoConfiguration.class,
		EndpointMBeanExportAutoConfiguration.class,
		AuditAutoConfiguration.class,
		MetricFilterAutoConfiguration.class

})
//@ComponentScan
public class AjkAplication {
	public static void main(String[] args) {
		if(System.getProperty("spring.profiles.active")==null){
			System.setProperty("spring.profiles.active", UserProfile.INTG);
		}
		
		SpringApplication.run(AjkAplication.class, args);
		
		StartUpCheckService startUpCheckService = SpringContextUtil.getBean(StartUpCheckService.class);
		startUpCheckService.startUpCheck();
	}
}
